'use strict';

/**
 * @ngdoc function
 * @name jgappApp.controller:FinanceFYhkhCtrl
 * @description
 * # FinanceFYhkhCtrl
 * Controller of the jgappApp
 */
angular.module('jgappApp')
    .controller('FinanceFYhkhCtrl', function ($scope, DataService, $rootScope, openApi, Util, $location, $routeParams, FormSubmit) {
        var id = $scope.process_id = $routeParams.id
            // 底部关联模块类型选框添加
        $scope.showfileType = function () {
            var param = {}
            param.type = "银行账户类型";
            DataService.getData(openApi.getKeyType, param).then(function (data) {
                $scope.AccountList = data
            })
        };
        $scope.submit = function (operationId) {

            // 底部类型end
            var options = {};
            // 流程id
            options.id = id;
            // 根据operationId判断是草稿还是提交
            options.operationId = operationId;
            options.urlParam = openApi.openAccount;
            options.param = angular.copy($scope.param, {});
            FormSubmit.submit(options,$scope);
        };
        $scope.validate = function () {
            if (!$scope.param.opeanAccountType) {
                Util.Toast("请选择账户类型");
                return;
            }
            if (!$scope.validation.passvalidation) {
                Util.Toast($scope.validation.tip);
                return;
            }
            return true;
        }
        var init = function () {
            // 获取回显的详细信息
            Util.getDetailData(id, function (data) {
                $scope.param = data;
            });
            $scope.showfileType();
        };
        // 初始化
        init();
    });